package cn.heygod.airsql.support;

import java.util.List;

/**
 * @className: Page
 * @author: Simon
 * @description: TODO
 * @date: 2024/1/27 3:06
 * @version: 1.0
 */
public class Page<T> {

    private List<T> list ;

    private int total;

    private int offset;

    public static <R> Page<R> of(int total,List<R> list){
        Page<R> page  = new Page<>();
        page.setTotal(total);
        page.setList(list);
        return page;
    }
    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getOffset() {
        return offset;
    }

    public void setOffset(int offset) {
        this.offset = offset;
    }

    @Override
    public String toString() {
        return new StringBuilder().append("total:").append(total).append(";offset:").append(offset).append(";list:").append(list.size()).toString();
    }
}
